<include file="Public:head" title='{$menu.name}' />
<script src="__PUBLIC__/js/other/validate.js"></script>
<script type="text/javascript">
    $(function() {
        var id = '{$detail.id}';
        var id_url = '';
        if (id > 0) {
            id_url = "/id/" + id + "";
        }
        var mobile = $('#mobile').val();
        jQuery.validator.addMethod("isMobile", function(value, element) {
            var length = value.length;
            var mobile = /^1[3,5,8]\d{9}$/;
            return (length == 11 && mobile.exec(value)) ? true : false;
        }, "请正确填写您的手机号码");
        $("#form").validate({
            errorPlacement: function(error, element) {
                var error_td = element.parent('td');
                error_td.find('label.error').hide();
                error_td.append(error);
            },
            rules: {
                pwd: {
                    minlength: 6,
                    maxlength: 20
                },
                phone: {
                    isMobile: true,
                }

            },
            messages: {
                pwd: {
                    minlength: '密码长度应在6-20个字符之间',
                    maxlength: '密码长度应在6-20个字符之间'
                },
                phone: {
                    isMobile: "请输入有效的手机号码",
                }

            }
        });
    });
</script>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li><a href="{:U('User/admin')}">管理员管理</a></li>
                    <li class="active">{$menu.name}</li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">
                                <h3 class="header smaller lighter blue">{$menu.name}</h3>

                                <form action="{:U('User/admin_detail_post')}" method="POST" id="form">
                                    <table class="table table_detail">
                                        <tbody>
                                            <tr>
                                                <td class="td_left">用户名:</td>
                                                <td>
                                                    <input class="common_txt" type="text" value="{$detail.name}" name="name"id="phone" />
                                                </td>
                                            </tr>
<!--                                            <tr>
                                                <td class="td_left">密码:</td>
                                                <td>
                                                    <input class="common_txt" type="password" value="" name="pwd" id="pwd" />
                                                </td>
                                            </tr>-->
<!--                                            <tr>
                                                <td class="td_left">是否管理员:</td>
                                                <td>
                                                    <label onclick="$('#tr_powers').hide()">
                                                        <input class="ace" type="radio" name="is_admin" value='0' {$detail.is_admin|getEqual=###,0,'checked'} autocomplete="off"/>
                                                        <span class="lbl"> 否</span>
                                                    </label>
                                                    <label onclick="$('#tr_powers').show()">
                                                        <input class="ace" type="radio" name="is_admin" value='1' {$detail.is_admin|getEqual=###,1,'checked'} autocomplete="off"/>
                                                        <span class="lbl"> 是</span>
                                                    </label>
                                                </td>
                                            </tr>-->
                                            <tr id="tr_powers">
                                                <td class="td_left">权限：</td>
                                                <td>
                                                    <table class="table table_detail">
                                                        <foreach name="powers" item="row">
                                                            <tr>
                                                                <td class="td_left">{$row.name}</td>
                                                                <td>
                                                            <foreach name="row['sub']" item="row2">
                                                                <label style="width:110px;display: inline-block">
                                                                    <input class="ace" type="checkbox"  name="powers[]" value="{$row2.id}" {$detail.powers|getChecked=###,$row2[id]}/>
                                                                    <span class="lbl"> {$row2.name}</span>
                                                                </label>
                                                            </foreach>
                                                            </td>
                                                            </tr>
                                                        </foreach>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left"></td>
                                                <td>
                                                    <input type='hidden' name='id' value='{$Think.get.id}'/>
                                                    <button class="btn btn-info btn-sm" type="submit">
                                                        <i class="icon-ok bigger-110 "></i>
                                                        保 存
                                                    </button>
                                                    <button class="btn btn-sm reset" type="button" onclick="goUrl(-1)">
                                                        <i class="icon-undo bigger-110"></i>
                                                        返 回
                                                    </button>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<include file="Public:foot" />